{% extends "./tmplinfo.html" %}
{% block headinfo %}
<script type="text/javascript">
    var obj = {};
    var option = '';

    function change(span) {
        $('span[name="' + $(span).attr('name') + '"]').each(function () {
            if (this.checked && this != span) {
                this.className = "label label-default";
                this.checked = false;
            }
        });
        obj[$(span).attr('name')] = $(span).attr('value');
        span.className = "label label-primary";

        span.checked = true;
        tt = span.value;
        select();
    }
    function select() {

        // 选择之后，将条件放到 url 中，
        var html_condition = window.location.href + '/con';
        var html_pagination = window.location.href + '/num';
        for (var ii in obj) {
            if (obj[ii] != '') {
                html_condition += '/' + ii + '/' + obj[ii];
                html_pagination += '/' + ii + '/' + obj[ii];
            }
        }

        html_condition += '?sort=' + option;
        html_pagination += '?sort=' + option;
        $.get(html_condition, function (result) {
            $("#resultSpan").html(result);
        });

        // $('#resultSpan').load(html_condition);
        $('#resultFenye').load(html_pagination);
    }
     function select_order(span,options) {
        $('span[name="' + $(span).attr('name') + '"]').each(function () {
            if (this.checked && this != span) {
                this.className = "label label-default";
                this.checked = false;
            }
        });

        span.className = "label label-primary";

        span.checked = true;
        option = options;
        select();
    }
</script>

<script type="text/javascript">
    $(function () {
        select();
    });
</script>
{% end %}
{% block typebody %}
<div class="row">
    <div class="col-sm-8">
        <ol class="breadcrumb">
               <li>{{ _('Current location') }}: <a href="{% module site_url() %}">{{ _('Home') }}</a></li>
            <li><a href="/filter/{{pcatinfo.uid}}">{{pcatinfo.name}}</a></li>
            {% if catinfo %}
            <li><a href="/filter/{{catinfo.uid}}">{{catinfo.name}}</a></li>
            {% end %}
            {% if userinfo and (userinfo.user_name=='admin' or  kwd.get('can_add',False)) %}
            <li><a href="/publish/{{ widget_info['parentid'] }}" class="btn btn-primary btn-sm">{{ _('Published') }}
                {{ widget_info['catname'] }} {{ _('Data') }}</a></li>
            {% end %}
        </ol>

 <div class="row">
            <div class="col-sm-12" style="font-size: 14px;padding-bottom: 15px">
                <span name="_order" value='1'
                      onclick="select_order(this,'time_create')"
                      class="btn btn-xs btn-default">
                    <span  class="glyphicon glyphicon-arrow-down"></span> {{ _('Creation time') }}</span>
                <span name="_order"
                      value='2'
                      onclick="select_order(this,'time_update')"
                      class="btn btn-xs btn-default">
                    <span class="glyphicon glyphicon-arrow-down"></span> {{ _('Update time') }}</span>
                <span name="_order"
                      value='6' onclick="select_order(this,'view_count')"
                    class="btn btn-xs btn-default">
                    <span class="glyphicon glyphicon-arrow-down"></span> {{ _('Browse times') }}</span>
            </div>
        </div>
        <ul class="list-group">

            {% block infolist %}
            {% end %}
        </ul>
        <div class="clear"></div>
        <div class="iga_pagination">
            <span id="resultFenye"></span>
        </div>
        <div class="clear"></div>

        <br>
    </div>
    <div class="col-sm-4">


        <div class="panel panel-black">
             <div class="panel-heading">
                 {{ _('Filter') }}

        </div>
            <ul class="list-group">


                {% block infoselect %} {% end %}
            </ul>
        </div>
        <div class="panel panel-black">
            <div class="panel-heading">
                <span class="title colorme">
                    {% for taginfo in cat_enum %}
                {% if taginfo.uid.endswith('00') %}
               {{ taginfo.name }}
                {% end %}
                {% end %}
                </span>
            </div>
            <ul class="list-group">
                {% for taginfo in cat_enum %}
                {% if not taginfo.uid.endswith('00') %}
                <li class="list-group-item"><a href="/filter/{{ taginfo.uid }}">{{ taginfo.name }}</a></li>
                {% end %}
                {% end %}
            </ul>
        </div>
        <div class="panel panel-black">
            <div class="panel-heading">
                <span class="title colorme"> {{ _('Recent documents') }} </span>
            </div>
            <ul class="list-group">
                {% module post_recent(8, with_date = False, with_catalog= False) %}
            </ul>
        </div>
    </div>
</div>
{% end %}
